<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of tumorSuppressorNetwork_Fig5A,B</title>
  <meta name="keywords" content="tumorSuppressorNetwork_Fig5A,B">
  <meta name="description" content="tumorSuppressorNetwork() creates a protein-protein interaction network">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../index.html">Home</a> &gt;  <a href="../index.html">code</a> &gt; <a href="index.html">examples</a> &gt; tumorSuppressorNetwork_Fig5A,B.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for code\examples&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>tumorSuppressorNetwork_Fig5A,B
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>tumorSuppressorNetwork() creates a protein-protein interaction network</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function tumorSuppressorNetwork() </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment"> tumorSuppressorNetwork() creates a protein-protein interaction network
 for 22 human tumor supressors (TS) and their interacting partners as found in
 PFAM database. 
 Also, interrogates the net to answer the following questions:
  - How P53 and BRCA1 relates to each other?
  - What are common interaction partners of p53 and Rb1?

 Node types: TS and a non-TS
 Edges: a domain-domain interaction reported in PFAM.
 See the TS list in createTumorSuppressorsNet()

 SYNTAX: [] = tumorSuppressorNetwork()

 See also createTumorSuppressorsNet(), createTSConnectionHeatmap_Fig5C,D.m

    DASMiner: DAS library and browser for Matlab.
    Diogo Veiga, Jan 2009.</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="createTumorSuppressorsNet.html" class="code" title="function [TSnet] = createTumorSuppressorsNet(dasURL,dsn,display)">createTumorSuppressorsNet</a>	createTumorSupressorsNet() constructs a protein-protein interaction</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
<!-- crossreference -->

<h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="#_sub1" class="code">function [status] = findPath(graph,labelA,labelB)</a></li><li><a href="#_sub2" class="code">function plotSubgraph(sourceGraph,nodeIDs,tsA,tsB)</a></li><li><a href="#_sub3" class="code">function [commonLabels,commonIDs]=findCommonInteractions(graph,labelA,labelB)</a></li></ul>
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function tumorSuppressorNetwork()</a>
0002 <span class="comment">% tumorSuppressorNetwork() creates a protein-protein interaction network</span>
0003 <span class="comment">% for 22 human tumor supressors (TS) and their interacting partners as found in</span>
0004 <span class="comment">% PFAM database.</span>
0005 <span class="comment">% Also, interrogates the net to answer the following questions:</span>
0006 <span class="comment">%  - How P53 and BRCA1 relates to each other?</span>
0007 <span class="comment">%  - What are common interaction partners of p53 and Rb1?</span>
0008 <span class="comment">%</span>
0009 <span class="comment">% Node types: TS and a non-TS</span>
0010 <span class="comment">% Edges: a domain-domain interaction reported in PFAM.</span>
0011 <span class="comment">% See the TS list in createTumorSuppressorsNet()</span>
0012 <span class="comment">%</span>
0013 <span class="comment">% SYNTAX: [] = tumorSuppressorNetwork()</span>
0014 <span class="comment">%</span>
0015 <span class="comment">% See also createTumorSuppressorsNet(), createTSConnectionHeatmap_Fig5C,D.m</span>
0016 <span class="comment">%</span>
0017 <span class="comment">%    DASMiner: DAS library and browser for Matlab.</span>
0018 <span class="comment">%    Diogo Veiga, Jan 2009.</span>
0019 
0020 
0021 TSnet_PFAM = <a href="createTumorSuppressorsNet.html" class="code" title="function [TSnet] = createTumorSuppressorsNet(dasURL,dsn,display)">createTumorSuppressorsNet</a>(<span class="string">'http://dasmi.bioinf.mpi-inf.mpg.de/das'</span>,<span class="string">'ddi'</span>,true);
0022 
0023 <span class="comment">% Question: How P53 and BRCA1 relates to each other?</span>
0024 status = <a href="#_sub1" class="code" title="subfunction [status] = findPath(graph,labelA,labelB)">findPath</a>(TSnet_PFAM,<span class="string">'TP53'</span>,<span class="string">'BRCA1'</span>);
0025 
0026 <span class="comment">% Question: common interaction partners of p53 and Rb1 (these are TS that</span>
0027 <span class="comment">% participate in cell cycle checkpoint during G1/S</span>
0028 <a href="#_sub3" class="code" title="subfunction [commonLabels,commonIDs]=findCommonInteractions(graph,labelA,labelB)">findCommonInteractions</a>(TSnet_PFAM,<span class="string">'TP53'</span>,<span class="string">'BRCA1'</span>);
0029 
0030 
0031 <a name="_sub1" href="#_subfunctions" class="code">function [status] = findPath(graph,labelA,labelB)</a>
0032 
0033 idxA = find(strcmp(labelA, get(graph.Nodes,<span class="string">'Label'</span>)));
0034 idxB = find(strcmp(labelB, get(graph.Nodes,<span class="string">'Label'</span>)));
0035 
0036 
0037 <span class="comment">% Color these blue</span>
0038 set(graph.Nodes(idxA),<span class="string">'Color'</span>,[0 0 1],<span class="string">'size'</span>,[50 40]);
0039 set(graph.Nodes(idxB),<span class="string">'Color'</span>,[0 0 1],<span class="string">'size'</span>,[50 40]);
0040 
0041 [dist,path,pred] = shortestpath(graph,idxA,idxB,<span class="string">'Directed'</span>, false);
0042 
0043 <span class="keyword">if</span> (~isempty(path))
0044     set(graph.Nodes(path),<span class="string">'Color'</span>,[1 0.4 0.4], <span class="string">'size'</span>,[70 40])
0045     edges = getedgesbynodeid(graph,get(graph.Nodes(path),<span class="string">'ID'</span>));
0046     set(edges,<span class="string">'LineColor'</span>,[1 0 0])
0047     set(edges,<span class="string">'LineWidth'</span>,1.5)
0048 
0049     dolayout(graph);
0050     view(graph);
0051     status = 1;
0052     
0053 <span class="keyword">else</span> <span class="comment">%no path between label A and label B</span>
0054     status = -1; 
0055 <span class="keyword">end</span>
0056 
0057 
0058 
0059 <a name="_sub2" href="#_subfunctions" class="code">function plotSubgraph(sourceGraph,nodeIDs,tsA,tsB)</a>
0060 <span class="keyword">global</span> tsEntrezID;
0061 sourceGraph.Nodes = getnodesbyid(sourceGraph,nodeIDs);
0062 <span class="comment">%sourceGraph.Edges = getedgesbynodeid(sourceGraph,nodeIDs(end-2:end),nodeIDs(1:end-2));</span>
0063 
0064 labels = get(sourceGraph.Nodes,<span class="string">'Label'</span>);
0065 idxA = find(strcmp(tsA, labels));
0066 idxB = find(strcmp(tsB, labels));
0067 
0068 cm = zeros(size(nodeIDs),size(nodeIDs));
0069 cm(idxA,1:end) = 1;
0070 cm(idxB,1:end) = 1;
0071 cm(idxA,idxA) = 0;
0072 cm(idxA,idxB) = 0;
0073 cm(idxB,idxA) = 0;
0074 cm(idxB,idxB) = 0;
0075 
0076 <span class="comment">%Create network</span>
0077 subGraph = biograph(cm,nodeIDs,<span class="string">'ShowArrows'</span>, <span class="string">'off'</span>, <span class="string">'LayoutType'</span>, <span class="string">'hierarchical'</span>); 
0078 
0079 
0080 <span class="comment">%Customize nodes in the graph</span>
0081 <span class="keyword">for</span> i=1:size(nodeIDs)
0082     
0083     idx = strmatch(subGraph.Nodes(i).ID,tsEntrezID,<span class="string">'exact'</span>);
0084     <span class="keyword">if</span>(~isempty(idx)) <span class="comment">%TS gene</span>
0085         set(subGraph.Nodes(i),<span class="string">'Color'</span>,[1 0 0]);
0086         set(subGraph.Nodes(i),<span class="string">'LineColor'</span>,[1.0000 0.7490 1.0000]);
0087         set(subGraph.Nodes(i),<span class="string">'LineWidth'</span>,1);
0088         
0089     <span class="keyword">else</span> <span class="comment">%other genes</span>
0090         set(subGraph.Nodes(i),<span class="string">'Color'</span>,[0 0.6824 0.7529]);
0091         set(subGraph.Nodes(i),<span class="string">'LineColor'</span>,[0 0.8078 0.7529]);
0092         set(subGraph.Nodes(i),<span class="string">'LineWidth'</span>,1);
0093         set(subGraph.Nodes(i),<span class="string">'Shape'</span>,<span class="string">'ellipse'</span>);
0094     <span class="keyword">end</span>
0095     set(subGraph.Nodes(i),<span class="string">'Label'</span>,labels{i});
0096 <span class="keyword">end</span>
0097 
0098 dolayout(subGraph);
0099 view(subGraph);
0100 
0101 
0102 <a name="_sub3" href="#_subfunctions" class="code">function [commonLabels,commonIDs]=findCommonInteractions(graph,labelA,labelB)</a>
0103 
0104 idxA = find(strcmp(labelA, get(graph.Nodes,<span class="string">'Label'</span>)));
0105 idxB = find(strcmp(labelB, get(graph.Nodes,<span class="string">'Label'</span>)));
0106 
0107 <span class="comment">% pANode = find(strcmp(tsEntrezID(idxA), get(graph.Nodes,'ID')));</span>
0108 <span class="comment">% pBNode = find(strcmp(tsEntrezID(idxB), get(graph.Nodes,'ID')));</span>
0109 
0110 partnersA = getdescendants(graph.nodes(idxA));
0111 partnersB = getdescendants(graph.nodes(idxB));
0112 
0113 partnersA_IDs = get(partnersA,<span class="string">'ID'</span>);
0114 partnersB_IDs = get(partnersB,<span class="string">'ID'</span>);
0115 
0116 idxCommon = [];
0117 <span class="keyword">for</span> i=1:size(partnersB_IDs,1)
0118    idx = find(strcmp(partnersB_IDs{i}, partnersA_IDs),1);
0119    <span class="keyword">if</span> (~isempty(idx))
0120       idxCommon = [idxCommon idx]; 
0121    <span class="keyword">end</span>
0122 <span class="keyword">end</span>
0123 
0124 commonLabels = get(partnersA(idxCommon),<span class="string">'Label'</span>);
0125 commonIDs = get(partnersA(idxCommon),<span class="string">'ID'</span>);
0126 
0127 <span class="keyword">if</span> (isempty(find(strcmp(num2str(graph.Nodes(idxA).ID),commonIDs),1)) )
0128     commonIDs = [commonIDs ; num2str(graph.Nodes(idxA).ID)];
0129 <span class="keyword">end</span>
0130 
0131 <span class="keyword">if</span> (isempty(find(strcmp(num2str(graph.Nodes(idxB).ID),commonIDs),1)) )
0132     commonIDs = [commonIDs ; num2str(graph.Nodes(idxB).ID)];
0133 <span class="keyword">end</span>
0134 
0135 <a href="#_sub2" class="code" title="subfunction plotSubgraph(sourceGraph,nodeIDs,tsA,tsB)">plotSubgraph</a>(graph,commonIDs,labelA,labelB);
0136 
0137</pre></div>
<hr><address>Generated on Tue 17-Feb-2009 16:14:02 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>